<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<script type='text/javascript' src='${pageContext.request.contextPath}/parts/framejs/ajax/ajax.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/parts/framejs/ajax/commonAjax.js'></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/parts/framejs/common/validate.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/parts/framejs/common/validatenum.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/parts/framejs/common/commontier.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/parts/framejs/My97DatePicker/WdatePicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/parts/framejs/ajax/jsonPaging.js"></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/comdwr.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/orderAjax.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/interface/ajax.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/engine.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/dwr/util.js'></script>
<script type="text/javascript">
var _path = '${pageContext.request.contextPath}';
<!--
 /*function inputmessage(message,spname,filetype) 
        {
           var sp = document.getElementById(spname);
           var ins = '';
           var j=0;
           var hidenvalue='';
           for(var i =0;i<message.length;i++){
           hidenvalue = hidenvalue + message[i]['id'] + "," ;
           	ins = ins + "<label id='lab"+message[i]['id']+"'><a href='#' onclick=\"downloadfile('"+message[i]['id']+"')\">"+message[i]['filename']+"</a><a onclick='delfile(\""+message[i]['id']+"\",\""+spname+"\",\""+filetype+"\")'>&nbsp;&nbsp;[删除]</a><br></label>";
           }
           //sp.innerHTML = ins+"<a onclick=\"doQueryMess('/docs/webdisk/fileupdate.jsp?isdisk=1&spname="+spname+"&filetype="+filetype+"','',600,300);return false;\" href=\"#\">上传文件</a>" ; 
           sp.innerHTML = ins+sp.innerHTML;
           document.getElementById("hid"+spname).value=document.getElementById("hid"+spname).value+hidenvalue;
           if( shuzu.length==0){
           sp.innerHTML = "<a onclick=\"doQueryMess('/docs/webdisk/fileupdate.jsp?isdisk=1&spname="+spname+"&filetype="+filetype+"','',600,300);return false;\" href=\"#\">上传文件</a>"
           }         
   }
	function downloadfile(id){
		
	var tempaction = document.forms[0].action;
	document.forms[0].action="${pageContext.request.contextPath}/fordownload.action?fid="+id;
	document.forms[0].submit();
	document.forms[0].action=tempaction;
	return false;
	}
	function delfile(fid,spname,filetype){
		alert(fid+"--"+spname+"--"+filetype)
	 var flag=0;
	 var sp = document.getElementById(spname);
	 document.getElementById("lab"+fid).innerHTML='';
		var  myhidden = document.getElementById("hid"+spname)
			myhidden.value = myhidden.value.replace(fid+',','');
		for(var i=0;i<sp["childNodes"].length;i++){
			if(sp["childNodes"][i].innerHTML!='')
				break;
			else
				flag++;
		}
		hcdwr.delfile(fid);
		if(flag==sp["childNodes"].length){
			sp.innerHTML = "<a onclick=\"doQueryMess('/docs/webdisk/fileupdate.jsp?isdisk=1&spname="+spname+"&filetype="+filetype+"','',600,300);return false;\" href=\"#\">上传文件</a>"
		}
		if(""==myhidden.value){
			sp.innerHTML = "<a onclick=\"doQueryMess('/docs/webdisk/fileupdate.jsp?isdisk=1&spname="+spname+"&filetype="+filetype+"','',600,300);return false;\" href=\"#\">上传文件</a>"
		}
		 
		
	}
	//附件修改页面显示  spname :spanID  ,filetype:允许上传的图片
	 function initsp(tablename,tempId,spname,filetype) 
        {
           var sp = document.getElementById(spname);
           var ins = '';
           //换dwr shixian
           var flist;
           DWREngine.setAsync(false);
           comdwr.getDiskfile(tablename,tempId,spname.substring(1,spname.length),function(obj){
        	  flist=obj; 
           });
           if(flist!=null&&flist.length>0){
            for(var i=0;i<flist.length;i++){
            	var s=flist[i];
            	var bb=(".JPG.JPEG.BMP.GIF.gif.jpg.jpeg.bmp").indexOf(s.expand);
	            if(bb!=-1){
	            	var tp="<label id='lab"+s.id+"'><img height='50' width='50' src='${pageContext.request.contextPath}/fordownload.action?fid="+s.id+"' style='color: hand' onclick=window.location.href=('${pageContext.request.contextPath}/fordownload.action?fid="+s.id+"')><a onclick='delfile(\""+s.id+"\",\""+spname+"\",\""+filetype+"\")'>[删除]</a>"
	            	ins = ins +tp;
	            }else{
	            	 ins = ins + "<label id='lab"+s.id+"'><a href='#' onclick=\"return downloadfile('"+s.id+"')\">"+s.filename+"</a><a onclick='delfile(\""+s.id+"\",\""+spname+"\",\""+filetype+"\")'>&nbsp;&nbsp;[删除]</a><br></label>";
	            }
            }
           }
           var hidenvalue='';
          // sp.innerHTML = ins ; 
           sp.innerHTML = ins+sp.innerHTML;
           document.getElementById("hid"+spname).value=document.getElementById("hid"+spname).value+hidenvalue;
     }*/
//-->
</script>
